<template>
	<view class="content" v-show="visible">
		<view class="detail">
			<view class="title row">
				<view class="col-5" @click="closeChange">
					取消
				</view>
				<view class="col-14 t_center t_size_34">
					选择出行人数
				</view>
				<view class="col-5 t_right" @click="sureChange">
					确定
				</view>
			</view>
			<radio-group name="radio" @change="radioChange">
				<view class="radio row" v-for="(item,index) in radioList" :key="index">
					<view class="col-12">
						{{item}}人
					</view>
					<view class="col-12 t_right">
						<radio :value="index" :checked="index==0"/><text></text>
					</view>
				</view>
			</radio-group>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'select-radio',
		props:{
			visible: {
				type:Boolean,
				default: ()=>{
					return false
				}
			},
			radioList: {
				type: Array,
				default:()=>{
					return []
				}
			}
		},
		data(){
			return {
				index: 0
			}
		},
		methods: {
			radioChange({detail}){
				this.index = detail.value;
			},
			sureChange(){
				this.$emit('change',this.radioList[this.index])
			},
			closeChange(){
				this.$emit('close','close')
			}
		}
	}
</script>

<style lang="scss">
	.content{
		width: 100%;
		height: 100%;
		position: fixed;
		top: 0;
		left: 0;
		background-color: rgba(0,0,0,0.2);
		transition-duration: 0.2s;
		/*     以下三值为默认值，稍后会详细介绍 */
		transition-property: all;
		transition-timing-function: ease;
		transition-delay: 0s;
		.detail{
			width: 100%;
			border-radius: 25rpx 25rpx 0 0 ;
			background-color: #FFFFFF;
			position: absolute;
			left: 0;
			bottom: 0;
			.title{
				width: 92%;
				padding: 0 4%;
				border-bottom: 1px solid #ededed;
				height: 96rpx;
				line-height: 96rpx;
				color: #333333;
				.t_right{
					color: #6CBF30;
				}
			}
			.radio{
				width: 92%;
				padding: 0 4%;
				line-height: 90rpx;
				color: #333333;
				border-bottom: 1px solid #ededed;
			}
		}
	}
</style>
